evtchn: don't bypass unlinking pIRQ when closing port
authorJan Beulich <jbeulich@suse.com>
Wed, 30 Sep 2020 07:11:48 +0000 (09:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 30 Sep 2020 07:11:48 +0000 (09:11 +0200)
commite301a706eb679a0246cf98324958deb3781c886a
treef1e0e3d3eaa6ee1441331fa4661e082a425d0a67
parentd4bfa0c78f48e6562667f8e9c898a548be633d77
evtchn: don't bypass unlinking pIRQ when closing port

There's no other path causing a terminal unlink_pirq_port() to be called
(evtchn_bind_vcpu() relinks it right away) and hence _if_ pirq can
indeed be NULL when closing the port, list corruption would occur when
bypassing the unlink (unless the structure never gets linked again). As
we can't come here after evtchn_destroy() anymore, (late) domain
destruction also isn't a reason for a possible exception, and hence the
only alternative looks to be that the check was pointless in the first
place. While I haven't observed the case, from code inspection I'm far
from sure I can exclude this being possible, so it feels more safe to
re-arrange the code instead.

Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/common/event_channel.c